package com.supinfo.sun.sungamers.gui.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.supinfo.sun.sungamers.enums.Level;
import com.supinfo.sun.sungamers.games.CapitalFinderGame;
import com.supinfo.sun.sungamers.games.NumberFinderGame;
import com.supinfo.sun.sungamers.gui.PlayFrame;
import com.supinfo.sun.sungamers.gui.SunGamerFrame;

/**
 * @author Liu, Bing(Locke)
 * @since 2011-6-5
 * @version 0.3
 */
public class PlayActionListener implements ActionListener {

	private SunGamerFrame gameFrame;

	public PlayActionListener(SunGamerFrame gameFrame) {
		this.gameFrame = gameFrame;
	}

	public void actionPerformed(ActionEvent e) {
		if (gameFrame.getRadioBtnNumGame().isSelected()) {
			if (gameFrame.getRadioBtnEasy().isSelected())
				new PlayFrame(new NumberFinderGame(Level.EASY));
			if (gameFrame.getRadioBtnMedium().isSelected())
				new PlayFrame(new NumberFinderGame(Level.MEDIUM));
			if (gameFrame.getRadioBtnHard().isSelected())
				new PlayFrame(new NumberFinderGame(Level.HARD));
		} else if (gameFrame.getRadioBtnCapGame().isSelected()) {
			if (gameFrame.getRadioBtnEasy().isSelected())
				new PlayFrame(new CapitalFinderGame(Level.EASY));
			if (gameFrame.getRadioBtnMedium().isSelected())
				new PlayFrame(new CapitalFinderGame(Level.MEDIUM));
			if (gameFrame.getRadioBtnHard().isSelected())
				new PlayFrame(new CapitalFinderGame(Level.HARD));
		}
	}

}
